<?php

namespace Plugin\MultiSeller\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class SellerResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return mixed
     * @throws \Exception
     */
    public function toArray($request)
    {
        $data = [
            'id'                  => $this->id,
            'store_name'          => $this->store_name,
            'email'               => $this->email,
            'status'              => $this->status,
            'settings'            => $this->settings,
            'created_at'          => time_format($this->created_at),
            'logo'                => image_resize($this->logo),
            'seller_group_name'   => $this->group->description->name ?? '',
        ];

        return $data;
    }
}
